# unwebtg-api


**unwebtg-api** is an unofficial API that does not require authorization in Telegram to retrieve data. Though, it limits the ability to download files and large media and even access to private channels/groups (restricted channels too). See Data Hierarchy to know what can you get.


## Installation

At first you should be sure that _Python3_  is installed in your system. If it isn't, you need to install it using the following commands:

#### for Debian/Ubuntu-based systems
```
apt update
apt install python3 python3-pip
```

#### for Arch-based systems
```
pacman -Syu
pacman -S python3 python3-pip
```

Next step is installing required python-packages that same for both:
```
pip install bs4
pip install requests
```
Or if you haven't added pip into your PATH:
```
python -m pip install bs4
python -m pip install requests
```

## Data hierarhy
```
<API>
|
+ <Contact>
| + counters <dictionary>
| | + 'Subscribers': <string>
| | + 'Links'      : <string>
| | + 'Videos'     : <string>
| | + 'Photos'     : <string>
| | + 'Files'      : <string>
| |
| + title <string>
| + extra <string>
| + description <string>
| + photo <dictionary>
| | + '160x160': <string>
| | + '320x320': <string>
| |
| + contact <string>
|
+ <Preview>
|
+ <Stickers>
|
+ <Lists>
|
+ <Message>  # METHODS NOT RELEASED YET
  + source <dictionary>
  | + 'title': <string>
  | + 'url'  : <string>
  |
  + text <string>
  |
  + media <tuple>
  | + <dictionary>
  | | + 'type'     : 'image' <string>
  | | + 'url'      : <string>
  | | 
  | + <dictionary>
  | | + 'type'     : 'audio' <string>
  | | + 'url'      : <string>
  | | + 'duration' : <string>
  | |
  | + <dictionary>
  |   + 'type'     : 'video' <string>
  |   + 'url'      : <string>
  |   + 'duration' : <string>
  |   + 'thumbnail': <string>
  | 
  + file <dictionary>
  | + 'title': <string>
  | + 'extra': <string>
  |
  + poll <dictionary>
  | + 'title'  : <string>
  | + 'type'   : <string>
  | + 'answers': <tuple>
  | | + 'percent': <integer>
  | | + 'text'   : <string>
  | |
  | + 'voters' : <string>
  |
  + link_preview <dictionary>
  | + + 'url'         : <string>
  | | + 'site-preview': <dictionary>
  | |   + 'name'       : <string>
  | |   + 'thumbnail'  : <string>
  | |   + 'title'      : <string>
  | |   + 'description': <string>
  | |
  | + + 'url'         : <string> 
  |   + 'media'       : <dictionary>
  |     + <dictionary>
  |     | + 'type'     : 'image' <string>
  |     | + 'url'      : <string>
  |     | 
  |     + <dictionary>
  |       + 'type'     : 'video' <string>
  |       + 'url'      : <string>
  |       + 'duration' : <string>
  |       + 'thumbnail': <string>
  |
  + metadata <dictionary>
  | + 'id'    : <integer>
  | + 'date'  : <datetime.datetime>
  | + 'views' : <string>
  | + 'edited': <bool>
  |
  + keyboard <tuple>
    + <dictionary>
      + 'text': <string>
      + 'url' : <string>
```

## To-do list:
- create methods for Preview, Stickers, Lists classes
- add terminal arguments support
- create query handling block with URL characters replacing
- return url_checking and url_handling into API class methods